package utils.json.data;

import java.util.HashMap;
import java.util.List;

import play.data.validation.Error;

public class MessageJson extends AbstractJson {
	
	public MessageJson(String message, List<Error> errors) {
		put("message", message);
		if(errors != null) {
			HashMap<String, String> map = new HashMap<String, String>();
			for(Error error : errors) map.put(error.getKey(), error.message());
			put("errors", map);
		}
		
	}
}
